package com.xmindguoguo.boot.util.spring;

import org.springframework.context.EnvironmentAware;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;

/**
 * 实现 EnvironmentAware 接口 读取 application.properties的数据 类似于@Value 这个注解的功能
 * 
 * @ClassName EnvironmentAwareUtil
 * @author <a href="892042158@qq.com" target="_blank">于国帅</a>
 * @date 2019年1月24日 下午4:39:27
 *
 */
@Configuration
public class EnvironmentAwareUtil implements EnvironmentAware {
    public static Environment environment;

    @Override
    public void setEnvironment(Environment environment) {
        EnvironmentAwareUtil.environment = environment;
    }
    // 直接调用 EnvironmentAwareUtil.environment.getProperty

}
